{% assign data = section.settings %}
{% assign blockId = block_id | default: section.block_id %}
<div
  class="block_marquee overflow-hidden"
  id="block_marquee-{{blockId}}"
  style="--bg-color: {{data.bg_color}};--text-color: {{data.text_color}};"
>
  <div class="content flex items-center w-full overflow-hidden {% if data.hover_stop %}marquee--pause-on-mouseover{% endif %}  marquee-direction-{{data.direction}}">
   {% for i in (1..10) %}
	<ul class="list marquee_container" style="--animation-speed: {{data.speed}}s;">
		{% for block in section.blocks %}
			{% if block.text != '' %}
			  <li class="list_item box-border mx-10 flex items-center {% if block.text_hollow %}lk{% endif %}">
				<a href="{{ block.link | setUrlDataFrom:data_from }}" class="inline-flex items-center">
          {% if block.image.src != '' %}
            {% include 'lazy_img', src: block.image.src, alt: block.image.alt,class: 'max-h-[16px] object-cover mr-2.5' %}
          {% endif %}
				  {{ block.text|html_content_filter }}
				</a>
			  </li>
			{% endif %}
		  {% endfor %}
    </ul>
   {% endfor %}
  </div>
</div>


{% schema %}
{
  "class": "block_blogs",
  "is_global": false,
  "icon": "icon-boke",
  "name": {
    "zh_CN": "滚动文本",
    "en_US": "Scroll text"
  },
  "max_blocks": 20,
  "blocks": [
    {
      "name": {
        "zh_CN": "滚动文本",
        "en_US": "Scroll text"
      },
      "type": "item",
      "settings": [
        {
          "type": "card_image",
          "label": {
            "zh_CN": "图标",
            "en_US": "Icon"
          },
          "default": {
            "src": "",
            "alt": ""
          },
          "info": {
            "zh_CN": "建议宽度16px，高度16px",
            "en_US": "Recommended width 16px, height 16px"
          },
          "id": "image"
        },
        {
          "type": "card_page_link",
          "label": {
            "zh_CN": "跳转链接",
            "en_US": "Jump links"
          },
          "default": {
            "type": "",
            "title": "",
            "url": ""
          },
          "id": "link"
        },
        {
          "type": "card_text_editor",
          "label": {
            "zh_CN": "文本内容",
            "en_US": "Text content"
          },
          "id": "text",
          "default": "SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR"
        },
        {
          "type": "card_switch",
          "label": {
            "zh_CN": "文字是否镂空",
            "en_US": "Whether the text is hollow"
          },
          "default": false,
          "id": "text_hollow"
        }
      ]
    }
  ],
  "settings": [
    {
      "type": "card_header",
      "label": {
        "zh_CN": "设置",
        "en_US": "Settings"
      }
    },
    {
      "type": "card_select",
      "label": {
        "zh_CN": "滚动方向",
        "en_US": "Scroll direction"
      },
      "default": "left",
      "id": "direction",
      "option": [
        {
          "label": {
            "zh_CN": "靠左",
            "en_US": "To the left"
          },
          "value": "left"
        },
        {
          "label": {
            "zh_CN": "靠右",
            "en_US": "To the right"
          },
          "value": "right"
        }
      ]
    },
    {
      "type": "card_slider",
      "label": {
        "zh_CN": "滚动速度",
        "en_US": "Scroll speed"
      },
      "id": "speed",
      "max": 60,
      "min": 1,
      "unit": "s",
      "default": 4
    },
    {
      "type": "card_switch",
      "label": {
        "zh_CN": "鼠标悬停时暂停",
        "en_US": "Pause on mouse hover"
      },
      "default": true,
      "id": "hover_stop"
    },
    {
      "type": "card_header",
      "label": {
        "zh_CN": "颜色设置",
        "en_US": "Color Settings"
      }
    },
    {
      "type": "card_color",
      "id": "bg_color",
      "label": {
        "zh_CN": "背景颜色",
        "en_US": "Background color"
      },
      "default": "#ffe8e8"
    },
    {
      "type": "card_color",
      "id": "text_color",
      "label": {
        "zh_CN": "文本颜色",
        "en_US": "Text color"
      },
      "default": "#b05d5d"
    }
  ],
  "default": {
    "settings": {
      "direction": "left",
      "speed": 15,
      "hover_stop": true,
      "bg_color": "#ffe8e8",
      "text_color": "#b05d5d"
    },
    "blocks": [
      {
        "image": {
          "src": "",
          "alt": ""
        },
        "link": {
          "type": "",
          "title": "",
          "url": ""
        },
        "text": "SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR",
        "text_hollow": false,
        "block_type": "item"
      },
      {
        "image": {
          "src": "",
          "alt": ""
        },
        "link": {
          "type": "",
          "title": "",
          "url": ""
        },
        "text": "SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR",
        "text_hollow": false,
        "block_type": "item"
      }
    ]
  }
}
{% endschema %}
